package de.mariusharbeck.saralentz.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import de.mariusharbeck.saralentz.dao.AlbumDao;
import de.mariusharbeck.saralentz.dao.impl.AlbumDaoImpl;
import de.mariusharbeck.saralentz.entity.Album;
import de.mariusharbeck.saralentz.entity.Bild;
import de.mariusharbeck.saralentz.service.AlbumService;

@Service("albumService")
public class AlbumServiceImpl implements AlbumService {

	private AlbumDao dao;

	public AlbumServiceImpl() {
		dao = new AlbumDaoImpl();
	}

	@Override
	public Album createAlbum(String name, ArrayList<Bild> bilder) {
		return dao.create(new Album(name, bilder));
	}

	@Override
	public void deleteAlbum(int id) {
		dao.delete(id);
	}

	@Override
	public Album findAlbum(int id) {
		return dao.find(id);
	}

	@Override
	public List<Album> findAlben() {
		return dao.findAll();
	}

	@Override
	public Album findAlbum(String name) {
		return dao.find(name);
	}

	@Override
	public List<Album> findAlbumLike(String name) {
		return dao.findLike(name);
	}

	@Override
	public Album updateAlbum(Album album) {
		return dao.update(album);
	}
}
